package com.iwhalecloud.bss.kite.cucc.service.custview.evolve;

import com.iwhalecloud.bss.kite.cucc.service.custview.evolve.task.AbstractCustViewTask;

import com.ztesoft.bss.common.bo.LoginInfo;
import com.ztesoft.bss.common.util.ContextUtil;

/**
 * @ClassName : CustViewCallableBuilder
 * @Description :
 * @Author : xie.zhengjun
 * @Date : 2021/4/30 17:09
 */
public final class CustViewCallableBuilder {

    private AbstractCustViewTask custViewTask;

    private Object[] args;

    private String sessionId;

    private LoginInfo loginInfo;

    public CustViewCallableBuilder() {
    }

    public CustViewCallableBuilder withSession() {
        this.sessionId = ContextUtil.getHttpSessoinId();
        this.loginInfo = ContextUtil.getLoginInfo();
        return this;
    }

    public CustViewCallableBuilder withSession(String sessionId, LoginInfo loginInfo) {
        this.sessionId = sessionId;
        this.loginInfo = loginInfo;
        return this;
    }

    public CustViewCallableBuilder setArgs(Object[] args) {
        this.args = args;
        return this;
    }

    public CustViewCallableBuilder setCustViewTask(AbstractCustViewTask custViewTask) {
        this.custViewTask = custViewTask;
        return this;
    }

    public CustViewCallable build() {
        CustViewCallable custViewCallable = new CustViewCallable();
        custViewCallable.setCustViewTask(custViewTask);
        custViewCallable.setArgs(args);
        custViewCallable.setSessionId(sessionId);
        custViewCallable.setLoginInfo(loginInfo);
        return custViewCallable;
    }

}
